package ReSofting.it.GoldDirector.Adapters;

import java.util.ArrayList;

import ReSofting.it.GoldDirector.R;
import ReSofting.it.GoldDirector.Model.myAggiunta;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.CheckedTextView;
import android.widget.FrameLayout;
import android.widget.TextView;


	public class CheckListArrAdapter extends ArrayAdapter<myAggiunta> 
	{
	    private ArrayList<myAggiunta> _items;
	    private int _resourceID ;

	    public CheckListArrAdapter(Context context, int textViewResourceId, ArrayList<myAggiunta>  pItems) 
	    {
	        super(context, textViewResourceId, pItems);
	        this._items = pItems;
	        this._resourceID = textViewResourceId;
	    }

	    @Override
	    public View getView(int position, View convertView, ViewGroup parent) 
	    {
	        View v = convertView;
	      
	        if (v == null) {
	            LayoutInflater vi = (LayoutInflater)  this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	            v = vi.inflate(_resourceID, null);
	        }
	      
	        myAggiunta item = _items.get(position);

				  if (item != null) {
					  
					  CheckBox tt = (CheckBox) v.findViewById(R.id.checkBoxRow);
					  tt.setText(item.NomeAgg);	
					  tt.setTag(item.IDAgg);
				  }
				  else
				  {		
					  FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(0,0); 
					  v.setLayoutParams(layoutParams);
				  }
			
			  
			  return v;
	    }//fM
	    
	    
	    
	}//fC
